<!doctype html>
<html lang="zh-CN">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>学习日志</title>
    {% load django_bootstrap5 %}
    {% bootstrap_css %}
    {% bootstrap_javascript %}
</head>

<body>
    <nav class="navbar navbar-expand-md navbar-light bg-light mb-4 border">
        <div class="container-fluid">
            <a class="navbar-brand" href="{% url 'application01:index' %}">
                学习日志</a>
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarCollapse"
                aria-controls="navbarCollapse" aria-expanded="false" aria-label="切换导航">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse" id="navbarCollapse">
                <ul class="navbar-nav me-auto mb-2 mb-md-0">
                    <li class="nav-item">
                        <a class="nav-link" href="{% url 'application01:topics' %}">
                            主题</a>
                    </li>
                </ul>
                <!-- 账户相关链接 -->
                <ul class="navbar-nav ms-auto mb-2 mb-md-0">
                    {% if user.is_authenticated %}
                    <li class="nav-item">
                        <span class="navbar-text me-2">您好, {{ user.username }}。
                        </span>
                    </li>
                    {% else %}
                    <li class="nav-item">
                        <a class="nav-link" href="{% url 'accounts:register' %}">
                            注册</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="{% url 'accounts:login' %}">
                            登录</a>
                    </li>
                    {% endif %}
                </ul>
                <!-- 账户相关链接结束 -->
                {% if user.is_authenticated %}
                <form action="{% url 'accounts:logout' %}" method='post'>
                    {% csrf_token %}
                    <button name='submit' class='btn btn-outline-secondary btn-sm'>
                        登出</button>
                </form>
                {% endif %}
            </div>
        </div>
    </nav>
    <main class="container">
        <div class="pb-2 mb-2 border-bottom">
            {% block page_header %}{% endblock page_header %}
        </div>
        <div>
            {% block content %}{% endblock content %}
        </div>
    </main>
</body>

</html>